Refactor array bracket access to dedicated AST node#8168
Refactor array bracket access to dedicated AST node#8168shulhi wants to merge 9 commits intorescript-lang:masterfrom
Conversation
|
Hmm, any reason you went with one new node to represent two different things? |
rescript
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
I had it split initially, but thought it would be better to represent this as a single node to be consistent with record update. | Pexp_record of expression record_element list * expression option
(* { l1=P1; ...; ln=Pn } (None)
{ E0 with l1=P1; ...; ln=Pn } (Some E0) *)but, you could also make a counter argument with Splitting |
|
This is not currently changing the parser. Guess wip. Just, it means it's not been tested yet. |
It was just my initial unfiltered response. With records it feels different somehow: |
|
Okay this is probably closer to record construction vs mutable record field assignment (two different nodes) rather than record update. This is still in draft though, it is still subject to change and I don't mind changing it to two different nodes. |
|
I also think 2 separate nodes are cleaner for this. Great work btw, this will be a good cleanup/enhancement. |
6a52ad2 to
de2dc18
Compare
Refactors array bracket access from
Pexp_apply(Array.get/set, ...)to a dedicatedPexp_indexAST node. This is an internal refactoring with no user-facing changes.Changes:
arr[0]now represented asPexp_index(arr, 0, None)in ASTarr[0] = valnow represented asPexp_index(arr, 0, Some(val))in ASTWhy: